
//窗口对象
var myWin;
/**
 * window对象的open方法
 */
function fn1(){
    myWin = window.open("ck.html","ck","width=400,height=400");
}

/**
 * window对象的closed属性
 */
function fn2(){
    if(myWin.closed){
        alert('窗口关闭了');
    }else{
        alert('窗口没关');
    }
}

/**
 * window对象[子级窗口无效]的高宽属性
 */
function fn3(){
    console.log(window.innerHeight, window.outerHeight);
    console.log(window.innerWidth, window.outerWidth);
}

/**
 * window对象的name属性
 */
 function fn4(){
    window.name = "abc";
    console.log(window.name);
}

/**
 * window对象的opener属性
 */
 function fn5(){
    myWin.opener.document.write("显示内容");
}

/**
 * window对象的confirm方法
 */
 function fn6(){
    var result = window.confirm("继续吗?");
    window.alert(result);
}

/**
 * window对象的close方法
 */
 function fn7(){
    if(window.confirm("确定关闭吗?")){
        myWin.close();
    }
}

/**
 * window对象的moveBy/moveTo方法
 */
 function fn8(){
    //myWin.moveBy(200,200);
    myWin.moveTo(200,200);
}

/**
 * window对象的resizeBy/resizeTo方法
 */
 function fn9(){
    //myWin.resizeBy(100,100);
    myWin.resizeTo(200,200);
}

/**
 * window对象的scrollBy/scrollTo方法
 */
 function fn10(){
    window.scrollBy(30,-300);
    window.scrollTo(0,0);
}

//定义延迟器对象
var ycq;
/**
 * window对象的setTimeout方法
 */
 function fn11(){
    //window.setTimeout("alert('执行逻辑代码');",2000);
    //window.setTimeout("hs()",2000);
    ycq = window.setTimeout(hs,2000);
}
function hs(){
    console.log("第一行逻辑");
    console.log("第二行逻辑");
    console.log("第三行逻辑");
}

//定义定时器对象
var dsq;
/**
 * window对象的setInterval方法
 */
 function fn12(){
    //window.setInterval("console.log('执行逻辑代码');",2000);
    //window.setInterval("hs()",2000);
    dsq = window.setInterval(hs,2000);
}

/**
 * window对象的clearTimeout方法
 */
 function fn13(){
    window.clearTimeout(ycq);
}

/**
 * window对象的clearInterval方法
 */
 function fn14(){
    window.clearInterval(dsq);
}

/**
 * navigator对象的appCodeName属性
 */
 function fn15(){
    alert(navigator.appCodeName);
    alert(navigator.appName);
    alert(navigator.appVersion);
}

/**
 * screen对象的height/width属性
 */
 function fn16(){
    alert(screen.width + "   " + screen.height);
}

/**
 * history对象的length属性
 */
 function fn17(){
    alert(history.length);
}

/**
 * history对象的back方法
 */
 function fn18(){
    history.back();
}

/**
 * history对象的forward方法
 */
 function fn19(){
    history.forward();
}

/**
 * history对象的go方法
 */
 function fn20(){
    history.go(1);
}

/**
 * location对象的属性
 */
 function fn21(){
    console.log("protocol：" + location.protocol);
    console.log("host：" + location.host);
    console.log("hostname：" + location.hostname);
    console.log("port：" + location.port);
    console.log("pathname：" + location.pathname);
    console.log("search：" + location.search);
    alert(location.href);
    location.href="ck.html";
}

/**
 * location对象的方法
 */
 function fn22(){
    //location.assign("ck.html");
    //location.replace("ck.html");
    location.reload();
 }